<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
			xmlns:c="http://java.sun.com/jsp/jstl/core">

	<h:panelGroup id="header" layout="block">

    <h:panelGroup id="widgetBar" layout="block">

      <h:panelGroup styleClass="headerWidget" layout="block">
        [ lang toggle ]
      </h:panelGroup>

			<!-- checkout widget -->
      <h:panelGroup styleClass="headerWidget" layout="block">
				<c:if test="${!empty cartManager.cart and
											cartManager.cart.numberOfItems != 0}">>

					<h:link outcome="checkout"  styleClass="bubble"
									value="proceed to checkout &#x279f;"/>
				</c:if>
      </h:panelGroup>

			<!-- shopping cart widget -->
      <h:panelGroup styleClass="headerWidget" layout="block">

				<h:graphicImage value="img/cart.gif" alt="shopping cart icon"
												id="cart"/>

				<!-- If 'numberOfItems' property doesn't exist, or if number of items
					in cart is 0, output '0', otherwise output 'numberOfItems' -->

				<h:panelGroup styleClass="horizontalMargin">
					<c:choose>
						<c:when test="${cartManager.cart.numberOfItems == null}">
							0
						</c:when>
						<c:otherwise>
							${cartManager.cart.numberOfItems}
						</c:otherwise>
					</c:choose>

					<!-- Handle singular/plural forms of 'item' -->
					<c:choose>
						<c:when test="${cartManager.cart.numberOfItems == 1}">
							item
						</c:when>
						<c:otherwise>
							items
						</c:otherwise>
					</c:choose>
				</h:panelGroup>

				<c:if test="${cartManager.cart != null and
											cartManager.cart.numberOfItems != 0}">

					<h:link outcome="cart"  styleClass="bubble"
									value="view cart;"/>
				</c:if>

      </h:panelGroup>

		</h:panelGroup>

		<h:panelGroup>
			<h:link outcome="index" >
				<h:graphicImage value="img/logo.png" id="logo" alt="Affable Bean logo"/>
			</h:link>

			<h:graphicImage value="img/logoText.png" id="logoText" alt="the affable bean"/>
		</h:panelGroup>

	</h:panelGroup>

</html>

